﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Studio77.PopBall.Util
{
    public class ScoreHelper
    {
        public static int GetTargetScore(int stageIndex)
        {
            if (stageIndex <= 9)
            {
                return FixScore(stageIndex);
            }
            else
            {
                return CalcScore(stageIndex);
            }
        }

        private static int FixScore(int stageIndex)
        {
            int result = 0;
            switch (stageIndex)
            {
                case 1:
                    result = 1000;
                    break;
                case 2:
                    result = 3000;
                    break;
                case 3:
                    result = 6000;
                    break;
                case 4:
                    result = 8000;
                    break;
                case 5:
                    result = 10000;
                    break;
                case 6:
                    result = 13000;
                    break;
                case 7:
                    result = 15000;
                    break;
                case 8:
                    result = 17000;
                    break;
                case 9:
                    result = 20000;
                    break;
            }
            return result;
        }

        private static int CalcScore(int stageIndex)
        {
            int result = 20000;
            int addUnit = 4000;
            for (int i = 0; i < stageIndex - 9; i++)
            {
                result += addUnit;
                if (i == 50)
                {
                    addUnit = 5000;
                }
            }
            return result;
        }

        public static int GetScore(int count)
        {
            //消除规则 2-10分一个，3-15分一个，4-20分一个，以此类推
            return count * 5 * count;
        }

        public static EliminateComment GetCommentType(int count)
        {
            EliminateComment result = EliminateComment.None;

            if (count > 17)
            {
                result = EliminateComment.Unbelievably;
            }
            else if (count > 13)
            {
                result = EliminateComment.Amazing;
            }
            else if (count > 9)
            {
                result = EliminateComment.Excellent;
            }
            else if (count > 7)
            {
                result = EliminateComment.Great;
            }
            else if (count > 5)
            {
                result = EliminateComment.Good;
            }
            else if (count > 3)
            {
                result = EliminateComment.Nice;
            }
            return result;
        }
    }

    public enum EliminateComment
    {

        None,
        Nice,
        Good,
        Excellent,
        Great,
        Amazing,
        Unbelievably
    }
}
